!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define("rb_wixui.thunderbolt[TextInput]",["react"],t):"object"==typeof exports?exports["rb_wixui.thunderbolt[TextInput]"]=t(require("react")):e["rb_wixui.thunderbolt[TextInput]"]=t(e.React)}("undefined"!=typeof self?self:this,(function(e){return function(){var t={5329:function(t){"use strict";t.exports=e},448:function(e){function t(){return e.exports=t=Object.assign?Object.assign.bind():function(e){for(var t=1;t{const n=[];return e&&n.push(`${l}${e}`),t.forEach((e=>{e&&(n.push(`${l}${e}`),n.push(e))})),n.join(" ")};const s=13,c=27;function d(e){return t=>{t.keyCode===e&&(t.preventDefault(),t.stopPropagation(),t.currentTarget.click())}}d(32),d(s),d(c);const p=({size:e,...t})=>n.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",width:e||"20",height:e||"20",...t},n.createElement("path",{fillRule:"evenodd",d:"M9.5,3 C13.084,3 16,5.916 16,9.5 C16,13.084 13.084,16 9.5,16 C5.916,16 3,13.084 3,9.5 C3,5.916 5.916,3 9.5,3 Z M9.5,4 C6.467,4 4,6.467 4,9.5 C4,12.533 6.467,15 9.5,15 C12.533,15 15,12.533 15,9.5 C15,6.467 12.533,4 9.5,4 Z M10,11 L10,12 L9,12 L9,11 L10,11 Z M10,7 L10,10 L9,10 L9,7 L10,7 Z"}));p.displayName="ErrorSmall";var f=p,m="TLWrjM",h="GIPQqH",v="JNgJbf";const g=e=>{let{errorMessage:t,errorMessageType:r,shouldShowValidityIndication:o,translations:a,dataHook:i,componentViewMode:l}=e;const u="editor"===l?(null==a?void 0:a.errorMessage)||"Error text displays here.":t;return"inline"===r&&o&&u?n.createElement("div",{"data-hook":i||"inline-error-message",className:m},n.createElement(f,{className:h}),n.createElement("span",{className:v},u)):null};var y={root:"text-input",inputEl:"text-input__input",inputLabel:"text-input__label"},b={input:"KvoMHf",hideNumberSpinner:"ErucfC",AppsTextInputSkin:"MpKiNN",appsTextInputSkin:"MpKiNN",inputWrapper:"pUnTVX",prefix:"eXvLsN","validation-indication":"LyB02C",validationIndication:"LyB02C",label:"wPeA6j",hasLabel:"qzvPmW","required-indication":"lPl_oN",requiredIndication:"lPl_oN",ResponsiveTextInputSkin:"ZXdXNL",responsiveTextInputSkin:"ZXdXNL"};const x="Please enter a phone number with {digits} digits",C="Please enter between 4 to 17 digits. You can include hyphens (-) or start with a (+), e.g., 555-123-4567 or +(222)987654321",E="Please enter between 4 to 17 digits. You can include dividers (-), e.g., 555-123-4567.",I=function(e,t,n){void 0===n&&(n=!0);return Array.from(t).reduce(((e,t,n)=>"-"===t?[...e,n]:e),[]).filter(((t,r)=>n?t<=e.length:t<=e.length+r))},M=(e,t)=>t.replace("{digits}",""+(e?e.replace(/-/g,"").length:0)),_=13,L=27;function N(e){return t=>{t.keyCode===e&&(t.preventDefault(),t.stopPropagation(),t.currentTarget.click())}}N(32),N(_),N(L);const O=["aria-id","aria-metadata","aria-type"],T=(e,t)=>Object.entries(e).reduce(((e,n)=>{let[r,o]=n;return t.includes(r)||(e[r]=o),e}),{}),V=e=>{const{role:t,tabIndex:n,tabindex:r,screenReader:o,lang:a,ariaAttributes:i={}}=e,l=Object.entries(i).reduce(((e,t)=>{let[n,r]=t;return{...e,[("aria-"+n).toLowerCase()]:r}}),{});return{role:t,tabIndex:null!=n?n:r,screenReader:o,ariaAttributes:T(l,O),lang:a}},P=()=>{},w=(e,r)=>{var o;const{skin:a,name:l,id:s,className:c="",customClassNames:d=[],dataTestId:p,value:f,inputType:m="text",label:h,placeholder:v,readOnly:_,required:L,isDisabled:N,pattern:O,autoComplete:T,autoComplete_:w,maxLength:A,min:R,max:S,step:j,numberSpinnerHidden:F,shouldShowValidityIndication:k,isValid:H,autoFocus:D,prefix:q,phoneFormat:X="",errorMessageType:Z="tooltip",validateValue:B=P,setValidityIndication:K=P,onBlur:U=P,onFocus:W=P,onKeyPress:$=P,onInput:z=P,onValueChange:G=P,onChange:J=P,onClick:Y=P,onDblClick:Q=P,onMouseEnter:ee=P,onMouseLeave:te=P,onHydrationComplete:ne=P,ariaAttributes:re,contentRef:oe,translations:ae,componentViewMode:ie,textInputAutoFillFixEnabled:le,lang:ue}=e,se=n.useRef(null),[ce,de]=n.useState(!0);n.useImperativeHandle(r,(()=>({focus:()=>{var e;null==(e=se.current)||e.focus()},blur:()=>{var e;null==(e=se.current)||e.blur()},setCustomValidity:t=>{var n,r;"message"===t.type?null==(n=se.current)||n.setCustomValidity(t.message):null==(r=se.current)||r.setCustomValidity(((e,t)=>{let{translations:n,phoneFormat:r}=t;switch(e.key){case"PHONE_FORMAT_LENGTH_VALIDATION_ERROR":return M(r,(null==n?void 0:n.phoneFormatLengthValidationError)||x);case"PHONE_FORMAT_DEFAULT_VALIDATION_ERROR":return(null==n?void 0:n.phoneFormatDefaultValidationError)||C;case"PHONE_FORMAT_COMPLEX_PHONE_DEFAULT_VALIDATION_ERROR":return(null==n?void 0:n.phoneFormatComplexPhoneDefaultValidationError)||E;default:return e.key}})(t,{translations:e.translations,phoneFormat:e.phoneFormat}))},getValidationMessage:()=>{var e;return null==(e=se.current)?void 0:e.validationMessage}})));const pe=n.useRef(),fe=n.useMemo((()=>"tel"===m&&X?((e,t)=>{const n=I(e,t,!1),r=Array.from(e);return n.forEach((e=>{e{let{shouldHideValidityIndication:t,shouldCallOnInput:n}=e;return e=>{const{value:r}=e.target;let o=r;if(X){const e=r.length{const r=I(e,t);return r.reduce(((t,o,a)=>{if(" "===e[o])t.splice(o-a,1);else if(" "!==e[o+1]||n)" "===e[o-1]&&n&&(e.split(" ").length-1{le&&!ye()&&J({...e,type:"change"})})(e),B()),t&&K(!1),n&&z(e)}};n.useEffect((()=>{var e,t;me({shouldHideValidityIndication:!0,shouldCallOnInput:!1})({target:{value:null!=(e=null==(t=se.current)?void 0:t.value)?e:""}}),ne({type:"onHydrationComplete"})}),[]);const he=i(b[a],c,u(y.root,...d),{[b.hasLabel]:!!h,[b.requiredIndication]:L,[b.validationIndication]:!!k}),{ariaAttributes:{"aria-label":ve,...ge}}=V({ariaAttributes:re}),ye=()=>!!se.current&&se.current===document.activeElement;return n.createElement("div",t()({id:s},(e=>Object.entries(e).reduce(((e,[t,n])=>(t.includes("data-")&&(e[t]=n),e)),{}))(e),{ref:oe,className:he,"data-testid":p,onClick:e=>{N||Y(e)},onDoubleClick:e=>{N||Q(e)},onMouseEnter:e=>{N||ee(e)},onMouseLeave:e=>{N||te(e)},lang:ue}),!!h&&n.createElement("label",{htmlFor:"input_"+s,className:i(b.label,u(y.inputLabel))},h),n.createElement("div",{className:b.inputWrapper},q&&n.createElement("div",{className:b.prefix},q),n.createElement("input",t()({name:l,ref:se,id:"input_"+s,className:i(b.input,"has-custom-focus",u(y.inputEl),{[b.hideNumberSpinner]:F}),type:m,value:fe,onFocus:W,onKeyDown:$,onChange:me({shouldHideValidityIndication:!0,shouldCallOnInput:!0}),onBlur:e=>{U(e),pe.current&&J({...e,type:"change"}),pe.current=!1,K(!0),ce&&de(!1)},placeholder:v,readOnly:_,required:L,"aria-required":L,"aria-invalid":(()=>{var e;if(!1===H)return!0;const t=!(null!=(e=se.current)&&e.validity.valid);return!ce&&t})(),pattern:O,maxLength:(()=>{let e=null===A?void 0:A;return X&&(e=X.length),e})(),minLength:X?X.length:void 0,disabled:N,autoComplete:T?"on":w||"off",step:null===j?void 0:j,min:null===R?void 0:R,max:null===S?void 0:S,autoFocus:D,"aria-label":ve||h?ve:v},ge))),n.createElement(g,{errorMessageType:Z,errorMessage:null==(o=se.current)?void 0:o.validationMessage,shouldShowValidityIndication:k,translations:ae,componentViewMode:ie}))};const A=e=>e.replace(/([A-Z])/g,(e=>`-${e.toLowerCase()}`));var R;const S={TextInput:{component:n.forwardRef(w),controller:(R=e=>{let{mapperProps:t,controllerUtils:n}=e;return{...t,...(r=n.updateProps,{onValueChange:e=>{r({value:e})},setValidityIndication:e=>{r({shouldShowValidityIndication:e})}})};var r},{useComponentProps:(e,t,n)=>{const r=(e=>({...e,updateStyles:t=>{const n=Object.entries(t).reduce(((e,[t,n])=>{return{...e,[(r=t,r.startsWith("--")?t:A(t))]:void 0===n?null:n};var r}),{});e.updateStyles(n)}}))(n);return R({mapperProps:e,stateValues:t,controllerUtils:r})}})}}}(),o}()})); //# sourceMappingURL=https://static.parastorage.com/services/editor-elements-library/dist/thunderbolt/rb_wixui.thunderbolt[TextInput].f9c909c9.bundle.min.js.map